/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2013/05/06
* File: OGLProgram.h
* Blog: http://www.cnblogs.com/zengqh/
**/

#pragma once

#include <render_system/BaseRenderSystem/Program.h>
#include "OGLVertexShader.h"
#include "OGLPixelShader.h"

namespace HY
{
class OGLProgram : public Program
{
	friend class OGLRenderSystem;
public:
	virtual ~OGLProgram();

	virtual void release();

	virtual void bind();

	virtual void unbind();

	virtual VertexShader* getVertexShader();

	virtual bool setVertexShader(VertexShader* vs);

	virtual PixelShader* getPixelShader();

	virtual bool setPixelShader(PixelShader* ps);

	virtual ProgramAttribute* getAttribute(const std::string& name);

	virtual ProgramUniform* getUniform(const std::string& name);

	virtual void addUniform(const std::string& name, ProgramUniform* u);

	virtual void addAttribute(const std::string& name, ProgramAttribute* a);
protected:
	OGLProgram();

protected:
	OGLVertexShader*							vs_;
	OGLPixelShader*								ps_;
	uint32										handle_;
	std::map<std::string, ProgramUniform*>		uniform_list_;
	std::map<std::string, ProgramAttribute*>	attribute_list_;
};
}